cd /home/test/
#cp daemon.json /etc/docker

kill `netstat -apn | grep "LISTEN " | grep "7070" | awk '{print $7}' | tr '/' ' ' | awk '{print $1}'`
kill `netstat -apn | grep "LISTEN " | grep "7071" | awk '{print $7}' | tr '/' ' ' | awk '{print $1}'`


running_services_list="ia_etcd ia_web_visualizer_deployment ia_etcd_ui_deployment ia_video_analytics_deployment ia_video_ingestion_deployment"
all_services_list="ia_etcd ia_etcd_provision ia_etcd_ui_deployment ia_video_analytics_deployment ia_web_visualizer_deployment ia_video_ingestion_deployment"

#stop services
for i in $running_services_list
  do
     if [ `sudo docker ps --filter name=$i -q | wc -l` -gt 0 ]; then
         echo "----------- stopping $i -------------"
         sudo docker stop `sudo docker ps --filter name=$i -q`
     fi
  done


remove containers
for i in $all_services_list
do
  if [ `sudo docker ps -a --filter name=$i -q | wc -l` -gt 0 ]; then
      echo "-------- removing container $i ---------"
      sudo docker rm `sudo docker ps -a --filter name=$i -q`
  fi
done

#systemctl stop docker
#umount /var/lib/docker/overlay2
#rm -rf /var/lib/docker/*
#rm -rf /opt/*
#rm -rf /var
#ls -l /var/lib/docker/*
#systemctl start docker

#systemctl daemon-reload
#systemctl restart docker

#cp provision_eis.sh /home/test/deployment/provision
cd deployment/provision
#cd /home/iotgw/eii_install_v2.4/deployment/provision
#pwd
./provision_eis.sh ../docker-compose.yml
cd ..
docker-compose up -d

cd ..
pwd
